﻿using System;
using System.Collections.Generic;
using System.Text;

namespace testarray {
    class Program {
        static private long elapsedMilliseconds() {
            TimeSpan t = DateTime.Now.Subtract(start);
            return t.Minutes * 60000 + t.Seconds * 1000 + t.Milliseconds;
        }
        static DateTime start;
        static void Main(string[] args) {
            execCase1();
            execCase2();
            execCase2b();
            execCase3();
        }
        static void execCase1() {
            int[] array = new int[1000000];

            int x = 0;
            start = DateTime.Now;
            for (int i = 0; i < 250; i++)
                for (int j = 0; j < 1000000; j++)
                    if (array[j] == 0) x++;
            System.Console.WriteLine("Case 1 - Time : {0} , Result : {1}", elapsedMilliseconds(), x);
        }
        static void execCase2() {
            int[, ,] array = new int[100, 100, 100];
            int x = 0;
            start = DateTime.Now;
            for (int i = 0; i < 250; i++)
                for (int j = 0; j < 100; j++)
                    for (int k = 0; k < 100; k++)
                        for (int l = 0; l < 100; l++)
                            if (array[j, k, l] == 0) x++;

            System.Console.WriteLine("Case 2 - Time : {0} , Result : {1}", elapsedMilliseconds(), x);
        }
        static void execCase2b() {
            int[, ,] array = new int[100, 100, 100];
            int x = 0;
            start = DateTime.Now;
            for (int i = 0; i < 250; i++)
                for (int l = 0; l < 100; l++)
                    for (int k = 0; k < 100; k++)
                        for (int j = 0; j < 100; j++)
                            if (array[j, k, l] == 0) x++;

            System.Console.WriteLine("Case 2b- Time : {0} , Result : {1}", elapsedMilliseconds(), x);
        }
        static void execCase3() {
            int[, , , , ,] array = new int[10, 10, 10, 10, 10, 10];
            int x = 0;
            start = DateTime.Now;
            for (int i = 0; i < 250; i++)
                for (int j = 0; j < 10; j++)
                    for (int k = 0; k < 10; k++)
                        for (int l = 0; l < 10; l++)
                            for (int a = 0; a < 10; a++)
                                for (int b = 0; b < 10; b++)
                                    for (int c = 0; c < 10; c++)
                                        if (array[j, k, l, a, b, c] == 0) x++;

            System.Console.WriteLine("Case 3 - Time : {0} , Result : {1}", elapsedMilliseconds(), x);
        }
    }
}